#ifndef _UI_BIPEDWIDGET_H_
#define _UI_BIPEDWIDGET_H_

#include "ui/ui_widget.h"
#include "bones/biped_instance.h"

namespace ui
{

class UIBipedWidget : public UIWidget
{
public:
	UIBipedWidget(UIWidget* pParent, const std::string& Name = "");
	virtual ~UIBipedWidget();

	/// load from table
	virtual	bool		Load(LuaPlus::LuaObject& _LObj);
	/// update
	virtual	bool		Tick(float dt);
	/// display
	virtual bool		Render(bool Force = false);
	/// register with LUA Bind
	static	void		Register(LuaPlus::LuaState* _pScript);

	virtual UIWidget*	GetClone();

	bones::BipedInstance*	GetBiped()							{ SetCacheDirty(); return &m_Biped; }
	void					SetBiped(const std::string& Anim);
	void					SetCacheDirty()						{ m_UpdateBiped = true; }

	const math::Vec2&		GetBipedOffset()					{ return m_BipedOffset; }
	void					SetBipedOffset(const math::Vec2& v)	{ m_BipedOffset = v; }
	float					GetBipedScale() const				{ return m_BipedScale; }
	void					SetBipedScale(float f)				{ m_BipedScale = f; SetCacheDirty(); }
	bool					GetIsCentered() const				{ return m_CenterBiped; }
	void					SetIsCentered(bool b)				{ m_CenterBiped = b; SetCacheDirty(); }
	bool					GetBipedHidden() const				{ return m_HideBiped; }
	void					SetBipedHidden(bool b)				{ m_HideBiped = b; }
	bool					GetBipedPaused() const				{ return m_PauseBiped; }
	void					SetBipedPaused(bool b)				{ m_PauseBiped = b; }

protected:
	/// export widget specifics to file
	virtual bool		ExportSpecificsToFile(script::WriteLua*	pWL);

	bones::BipedInstance	m_Biped;
	math::Vec2				m_BipedOffset;
	float					m_BipedScale;
	bool					m_CenterBiped;
	bool					m_HideBiped;
	bool					m_PauseBiped;

private:
	math::Vec2				m_PrevSize, m_PrevPos;
	bool					m_UpdateBiped;

}; // class UIBipedWidget

}  // namespace ui


#endif //_UI_BIPEDWIDGET_H_